textlayout: introduce caching for GtkTextLineDisplay
authorChristian Hergert <chergert@redhat.com>
Fri, 26 Jul 2019 17:40:43 +0000 (10:40 -0700)
committerChristian Hergert <chergert@redhat.com>
Sun, 28 Jul 2019 17:34:15 +0000 (10:34 -0700)
commit9926e6ebde28956ae65e5127966fd740552fbe6a
tree39a8c56dd5b059b2b1da5b8097e2160344617150
parentb930c5a8a2545a8534585ae92f2d25a9581d345d
textlayout: introduce caching for GtkTextLineDisplay

This adds a GtkTextLineDisplayCache which can be used to cache a number
of GtkTextLineDisplay (and thus, PangoLayout) while displaying a view.

It uses a GSequence to track the position of the GtkTextLineDisplay
relative to each other, a MRU to cull the least recently used display,
and and a direct hashtable to lookup display by GtkTextLine.

We only cache lines that are to be displayed (!size_only). We may want to
either create a second collection of "size_only" lines to speed that up,
or determine that it is unnecessary (which is likely the case).
gtk/gtktextlayout.c
gtk/gtktextlayoutprivate.h
gtk/gtktextlinedisplaycache.c [new file with mode: 0644]
gtk/gtktextlinedisplaycacheprivate.h [new file with mode: 0644]
gtk/meson.build